<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="notifyBtn">通知消息</button>
</body>
<script>
    var notifyBtn = document.getElementById('notifyBtn');
    // 标题
    var title='程序员大本营';
    var option = {
        // 通知的内容
        body:'程序员小佟上线啦！',
    }
    notifyBtn.onclick = function(){
        new window.Notification(title,option)
    }
</script>
</html>